package com.asistencia.businness;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.asistencia.dao.interfaces.CareerDao;
import com.asistencia.domain.Career;


@Service
public class CareerBusiness {
	
@Autowired
private CareerDao careerdao;

@Autowired
private Career career;

public List<Career> listAll(){
	try{
		careerdao.listAll();
		List<Career> lisAll=careerdao.listAll();
		return lisAll;
	}catch(DataAccessException e){
		e.printStackTrace();
		return null;
	} catch(Exception e){
		e.printStackTrace();
		return null;
	}	}
public List<Career> listByName(String name)  {

	try{
		careerdao.listByName(name);
		List<Career> lstByName=careerdao.listByName(name);
		return lstByName;
		} catch (DataAccessException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return null;
	} catch(Exception e){
		e.printStackTrace();
		return null;
	}
	}

public Career getById(Integer idCareer){
	try {
		career= careerdao.getById(idCareer);
			return career;	
		}

catch (DataAccessException e){
		e.printStackTrace();
		return null;
	}}

	

}
